package com.shanghaionstar.mro.util;

import android.content.Context;

import java.util.HashMap;

/**
 * Created by kai zhang on 2015/10/28 10:05.
 */
public class MrOServiceIntroduction {
    private static MrOServiceIntroduction serviceIntroduction = new MrOServiceIntroduction();
    private HashMap<String, String> introductionMap;

    public static MrOServiceIntroduction getInstance() {
        return serviceIntroduction;
    }

    private MrOServiceIntroduction() {
    }

    private void initMap(Context context) {
        introductionMap = new HashMap<String, String>();
        for (int i = 0; i < 25; i++) {
            introductionMap.put("Message" + (i + 1),
                    context.getString(context.getResources().getIdentifier("mro_serivce_introduction" + (i + 1), "string", "com.shanghaionstar")));
        }
    }

    public String getIntroduction(String type, Context context) {
        if (introductionMap == null) {
            if (context == null) {
                throw new IllegalStateException("Must transfer non-null context at least once!");
            }
            initMap(context);
        }
        return introductionMap.get(type);
    }
}
